package org.lx.nursing.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.lx.nursing.domain.Bed;
import org.lx.nursing.mapper.BedMapper;
import org.lx.nursing.service.IBedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Service
public class BedServiceImpl extends ServiceImpl<BedMapper, Bed> implements IBedService {
    @Autowired
    private BedMapper bedMapper;

    @Override
    public Bed selectBedById(Long id) {
        return getById(id);
    }

    @Override
    public List<Bed> selectBedList(Bed bed) {
        return bedMapper.selectBedList(bed);
    }

    @Override
    public int insertBed(Bed bed) {
        return save(bed) ? 1 : 0;
    }

    @Override
    public int updateBed(Bed bed) {
        return updateById(bed) ? 1 : 0;
    }

    @Override
    public int deleteBedByIds(Long[] ids) {
        return removeByIds(Arrays.asList(ids)) ? 1 : 0;
    }

    @Override
    public int deleteBedById(Long id) {
        return removeById(id) ? 1 : 0;
    }
}
